﻿using System;
namespace Xtee.XteeClient.Taitis {
    using Producers.Taitis.Xtee.Riik.Ee.Producer.Taitis;
    using Producers.Taitis.Xtee.Riik.Ee.Producer.Taitis.Messages;
    using global::Xtee.Core;
    using System.Collections.Generic;
    
    
    public class TaitisAdapter {
        
        private string _producer = "taitis";
        
        private string _toimik;
        
        private string _allAsutus;
        
        private string _amet;
        
        private string _ametnikNimi;
        
        private string _autentija;
        
        private string _ametnik;
        
        private Xtee.Core.Client.IXteeCommand _xteeCommand;
        
        public TaitisAdapter() : 
                this(new Xtee.Core.Client.XteeCommand(new Xtee.Core.Client.Config.Configuration())) {
        }
        
        public TaitisAdapter(Xtee.Core.Client.IXteeCommand command) {
            this._xteeCommand = command;
            if (!string.IsNullOrEmpty(_xteeCommand.Configuration.AlternateProducer)) {
                this._producer = _xteeCommand.Configuration.AlternateProducer;
            }
        }
        
        public virtual string Producer {
            get {
                return this._producer;
            }
            set {
                this._producer = value;
            }
        }
        
        public virtual string Toimik {
            get {
                return this._toimik;
            }
            set {
                this._toimik = value;
            }
        }
        
        public virtual string AllAsutus {
            get {
                return this._allAsutus;
            }
            set {
                this._allAsutus = value;
            }
        }
        
        public virtual string Amet {
            get {
                return this._amet;
            }
            set {
                this._amet = value;
            }
        }
        
        public virtual string AmetnikNimi {
            get {
                return this._ametnikNimi;
            }
            set {
                this._ametnikNimi = value;
            }
        }
        
        public virtual string Autentija {
            get {
                return this._autentija;
            }
            set {
                this._autentija = value;
            }
        }
        
        public virtual string Ametnik {
            get {
                return this._ametnik;
            }
            set {
                this._ametnik = value;
            }
        }
        
        public virtual Xtee.Core.Client.IXteeCommand XteeCommand {
            get {
                return this._xteeCommand;
            }
            set {
                this._xteeCommand = value;
            }
        }
        
        public virtual string KonstrueeriTeenuseNimi(string teenuseNimi, string versioon) {
            return string.Format("{0}.{1}.{2}", this.Producer, teenuseNimi,versioon);
        }
        
        public virtual global::Producers.Taitis.Xtee.Riik.Ee.Producer.Taitis.IMinuToimikudVastus MinuToimikud(global::Producers.Taitis.Xtee.Riik.Ee.Producer.Taitis.IMinuToimikudParing keha) {
            global::Xtee.Core.Envelope.ISoapEnvelope responseEnvelope = _xteeCommand.Execute(new global::Xtee.Core.Envelope.SoapEnvelope("http://producers.taitis.xtee.riik.ee/producer/taitis", "minu_toimikud", new Xtee.Core.Envelope.StandardHeader(_xteeCommand.Configuration.Asutus, this.Producer, _xteeCommand.Configuration.Isikukood, Xtee.Core.Utils.StringUtils.GenerateNonce(), this.KonstrueeriTeenuseNimi("minu_toimikud", "v1"), this.Toimik, this.AllAsutus, this.Amet, this.AmetnikNimi, this.Autentija), new global::Producers.Taitis.Xtee.Riik.Ee.Producer.Taitis.Messages.MinuToimikud(keha)));
            return ((global::Producers.Taitis.Xtee.Riik.Ee.Producer.Taitis.Messages.IMinuToimikudResponse)(responseEnvelope.Body)).Keha;
        }
        
        public virtual global::Producers.Taitis.Xtee.Riik.Ee.Producer.Taitis.IParing2Vastus Paring2(global::Producers.Taitis.Xtee.Riik.Ee.Producer.Taitis.IParing2Paring keha) {
            global::Xtee.Core.Envelope.ISoapEnvelope responseEnvelope = _xteeCommand.Execute(new global::Xtee.Core.Envelope.SoapEnvelope("http://producers.taitis.xtee.riik.ee/producer/taitis", "paring2", new Xtee.Core.Envelope.StandardHeader(_xteeCommand.Configuration.Asutus, this.Producer, _xteeCommand.Configuration.Isikukood, Xtee.Core.Utils.StringUtils.GenerateNonce(), this.KonstrueeriTeenuseNimi("paring2", "v1"), this.Toimik, this.AllAsutus, this.Amet, this.AmetnikNimi, this.Autentija), new global::Producers.Taitis.Xtee.Riik.Ee.Producer.Taitis.Messages.Paring2(keha)));
            return ((global::Producers.Taitis.Xtee.Riik.Ee.Producer.Taitis.Messages.IParing2Response)(responseEnvelope.Body)).Keha;
        }
        
        public virtual global::Producers.Taitis.Xtee.Riik.Ee.Producer.Taitis.IParing3Vastus Paring3(global::Producers.Taitis.Xtee.Riik.Ee.Producer.Taitis.IParing3Paring keha) {
            global::Xtee.Core.Envelope.ISoapEnvelope responseEnvelope = _xteeCommand.Execute(new global::Xtee.Core.Envelope.SoapEnvelope("http://producers.taitis.xtee.riik.ee/producer/taitis", "paring3", new Xtee.Core.Envelope.StandardHeader(_xteeCommand.Configuration.Asutus, this.Producer, _xteeCommand.Configuration.Isikukood, Xtee.Core.Utils.StringUtils.GenerateNonce(), this.KonstrueeriTeenuseNimi("paring3", "v1"), this.Toimik, this.AllAsutus, this.Amet, this.AmetnikNimi, this.Autentija), new global::Producers.Taitis.Xtee.Riik.Ee.Producer.Taitis.Messages.Paring3(keha)));
            return ((global::Producers.Taitis.Xtee.Riik.Ee.Producer.Taitis.Messages.IParing3Response)(responseEnvelope.Body)).Keha;
        }
        
        public virtual global::Producers.Taitis.Xtee.Riik.Ee.Producer.Taitis.IParing4Vastus Paring4(global::Producers.Taitis.Xtee.Riik.Ee.Producer.Taitis.IParing4Paring keha) {
            global::Xtee.Core.Envelope.ISoapEnvelope responseEnvelope = _xteeCommand.Execute(new global::Xtee.Core.Envelope.SoapEnvelope("http://producers.taitis.xtee.riik.ee/producer/taitis", "paring4", new Xtee.Core.Envelope.StandardHeader(_xteeCommand.Configuration.Asutus, this.Producer, _xteeCommand.Configuration.Isikukood, Xtee.Core.Utils.StringUtils.GenerateNonce(), this.KonstrueeriTeenuseNimi("paring4", "v1"), this.Toimik, this.AllAsutus, this.Amet, this.AmetnikNimi, this.Autentija), new global::Producers.Taitis.Xtee.Riik.Ee.Producer.Taitis.Messages.Paring4(keha)));
            return ((global::Producers.Taitis.Xtee.Riik.Ee.Producer.Taitis.Messages.IParing4Response)(responseEnvelope.Body)).Keha;
        }
        
        public virtual global::Producers.Taitis.Xtee.Riik.Ee.Producer.Taitis.IParing4Vastus Paring5(global::Producers.Taitis.Xtee.Riik.Ee.Producer.Taitis.IPais2 keha) {
            global::Xtee.Core.Envelope.ISoapEnvelope responseEnvelope = _xteeCommand.Execute(new global::Xtee.Core.Envelope.SoapEnvelope("http://producers.taitis.xtee.riik.ee/producer/taitis", "paring5", new Xtee.Core.Envelope.StandardHeader(_xteeCommand.Configuration.Asutus, this.Producer, _xteeCommand.Configuration.Isikukood, Xtee.Core.Utils.StringUtils.GenerateNonce(), this.KonstrueeriTeenuseNimi("paring5", "v1"), this.Toimik, this.AllAsutus, this.Amet, this.AmetnikNimi, this.Autentija), new global::Producers.Taitis.Xtee.Riik.Ee.Producer.Taitis.Messages.Pais2(keha)));
            return ((global::Producers.Taitis.Xtee.Riik.Ee.Producer.Taitis.Messages.IParing4Response)(responseEnvelope.Body)).Keha;
        }
    }
}
